How can I fix the 'str' and 'float' concatenation error in my Python code